package structure_结构性.proxy_pattern_代理模式;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: hihi
 * @Date: 2020/07/07/14:43
 * @Description:
 */
public class ProxyRealImageDisplay implements Image {

	private RealImageDisplay realImageDisplay;

	private String fileName;

	public ProxyRealImageDisplay(String fileName) {
		this.fileName = fileName;
	}

	@Override public void display() {
		if (realImageDisplay == null) {
			realImageDisplay = new RealImageDisplay(fileName);
		}
		realImageDisplay.display();
	}
}
